How to create batch file that delete all the folders named `bin` or `obj` recursively?

Posted by Nam Gi VU on Super User See other posts from Super User or by Nam Gi VU
Published on 2010-10-21T12:25:50Z Indexed on 2011/01/15 23:55 UTC
Read the original article Hit count: 158

I have the need of deleting all bin & obj folders in a folder on my PC. So, I'm thinking of a batch file to do that but I'm not famaliar with batching file in Windows. Please help.

[Edit]

After discussion with user DMA57361, I got to the current solution (still having problem though, see our comments):

Create a .bat file, and paste the below command:

start for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s/q "%%d"

OR

start for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s "%%d"

@DMA57361: When I run your script, I get the below error. Any idea?

alt text

© Super User or respective owner

Related posts about windows-7

Related posts about command-line